package com.piece.mall.model;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

@Data
@Entity
@NoArgsConstructor
@Table(name = "oms_order")
@ApiModel(value = "订单")
public class OmsOrder implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", length = 11)
    @ApiModelProperty(value = "主键")
    private Long id;

    @Column(name = "user_id")
    @ApiModelProperty(value = "用户主键")
    private Long userId;

    @Column(name = "order_sn")
    @ApiModelProperty(value = "订单号")
    private String orderSn;

    @Column(name = "coupon_id")
    @ApiModelProperty(value = "使用的优惠券")
    private Long couponId;

    @Column(name = "create_time")
    @ApiModelProperty(value = "创建时间")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date createTime;

    @Column(name = "username")
    @ApiModelProperty(value = "用户名")
    private String username;

    @Column(name = "total_amount")
    @ApiModelProperty(value = "订单总额")
    private BigDecimal totalAmount;

    @Column(name = "pay_amount")
    @ApiModelProperty(value = "应付总额")
    private BigDecimal payAmount;

    @Column(name = "freight_amount")
    @ApiModelProperty(value = "运费金额")
    private BigDecimal freightAmount;

    @Column(name = "promotion_amount")
    @ApiModelProperty(value = "促销优化金额")
    private BigDecimal promotionAmount;

    @Column(name = "integration_amount")
    @ApiModelProperty(value = "积分抵扣金额")
    private BigDecimal integrationAmount;

    @Column(name = "coupon_amount")
    @ApiModelProperty(value = "优惠券抵扣金额")
    private BigDecimal couponAmount;

    @Column(name = "discount_amount")
    @ApiModelProperty(value = "后台调整折扣金额")
    private BigDecimal discountAmount;

    @Column(name = "pay_type")
    @ApiModelProperty(value = "支付方式", notes = "1=支付宝, 2=微信")
    private String payType;

    @Column(name = "channel_code")
    @ApiModelProperty(value = "支付渠道类别")
    private String channelCode;

    @Column(name = "status")
    @ApiModelProperty(value = "订单状态", notes = "0=待付款, 1=待发货, 2=已发货, 3=已完成, 4=已关闭, 5=无效订单")
    private String status;

    @Column(name = "delivery_company")
    @ApiModelProperty(value = "物流公司(配送方式)")
    private String deliveryCompany;

    @Column(name = "delivery_sn")
    @ApiModelProperty(value = "物流单号")
    private String deliverySn;

    @Column(name = "auto_confirm_day")
    @ApiModelProperty(value = "自动确认时间（天）")
    private Integer autoConfirmDay;

    @Column(name = "integration")
    @ApiModelProperty(value = "可以获得的积分")
    private Long integration;

    @Column(name = "growth")
    @ApiModelProperty(value = "可以获得的成长值")
    private Long growth;

    @Column(name = "bill_type")
    @ApiModelProperty(value = "发票类型", notes = "0=不开发票, 1=电子发票, 2=纸质发票")
    private String billType;

    @Column(name = "bill_header")
    @ApiModelProperty(value = "发票抬头")
    private String billHeader;

    @Column(name = "bill_content")
    @ApiModelProperty(value = "发票内容")
    private String billContent;

    @Column(name = "bill_receiver_phone")
    @ApiModelProperty(value = "收票人电话")
    private String billReceiverPhone;

    @Column(name = "bill_receiver_email")
    @ApiModelProperty(value = "收票人邮箱")
    private String billReceiverEmail;

    @Column(name = "receiver_name")
    @ApiModelProperty(value = "收货人姓名")
    private String receiverName;

    @Column(name = "receiver_phone")
    @ApiModelProperty(value = "收货人电话")
    private String receiverPhone;

    @Column(name = "receiver_post_code")
    @ApiModelProperty(value = "收货人邮编")
    private String receiverPostCode;

    @Column(name = "receiver_province")
    @ApiModelProperty(value = "省份/直辖市")
    private String receiverProvince;

    @Column(name = "receiver_city")
    @ApiModelProperty(value = "城市")
    private String receiverCity;

    @Column(name = "receiver_region")
    @ApiModelProperty(value = "区")
    private String receiverRegion;

    @Column(name = "receiver_detail_address")
    @ApiModelProperty(value = "详细地址")
    private String receiverDetailAddress;

    @Column(name = "remark")
    @ApiModelProperty(value = "订单备注")
    private String remark;

    @Column(name = "confirm_status")
    @ApiModelProperty(value = "确认收货状态", notes = "0=未确认, 1=已确认")
    private String confirmStatus;

    @Column(name = "delete_status")
    @ApiModelProperty(value = "状态", notes = "0=有效, 1=无效")
    private String deleteStatus;

    @Column(name = "use_integration")
    @ApiModelProperty(value = "下单时使用的积分")
    private Long useIntegration;

    @Column(name = "payment_time")
    @ApiModelProperty(value = "支付时间")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date paymentTime;

    @Column(name = "delivery_time")
    @ApiModelProperty(value = "发货时间")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date deliveryTime;

    @Column(name = "receive_time")
    @ApiModelProperty(value = "确认收货时间")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date receiveTime;

    @Column(name = "comment_time")
    @ApiModelProperty(value = "评价时间")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date commentTime;

    @Column(name = "modify_time")
    @ApiModelProperty(value = "修改时间")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date modifyTime;
}
